<template>
  <div class="product">
    <div class="img-box">
      <img class="auto-img" :src="pro.smallImg" alt="" />
    </div>
    <div class="pro-info">
      <div class="product-name">
        {{ pro.name }}
        <van-tag v-if="pro.isHot === 1" plain color="#e4393c"><van-icon name="fire" /></van-tag>
      </div>
      <div class="product-enname one-text">{{ pro.enname }}</div>
      <div class="product-price">&yen;{{ pro.price }}</div>
      
    </div>

    <div class="badge-box">
      <div class="pro-remove" v-if="isRemove" @click.stop="remove">
        <van-icon name="delete-o" />
      </div>
      <div class="add">+</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Product",
  props: {
    pro: {
      type: Object,
      default() {
        return {};
      },
    },

    isRemove: {
      type: Boolean,
      default: false,
    },
  },

  methods: {
    //删除
    remove() {
      this.$emit("remove");
    },
  },
};
</script>

<style lang="less" scoped>
.product {
  margin-top: 10px;
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  .img-box {
    margin-left: 10px;
    width: calc(30%);
    .auto-img {
      border-radius: 50%;
    }
  }
  .badge-box {
    position: relative;
    width: calc(10%);
    .add {
      text-align: center;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      border: solid 1px #dddddd;
      color: gray;
      background-color: #1239b3;
      color: #ffffff;
      font-size: 15px;
      position: absolute;
      bottom: 0;
      right: 5px;
    }

    .add:active {
      background-color: #ffffff;
      color: #1239b3;
    }
  }
  .product-name {
    width: 100%;
    font-size: 14px;
    /deep/ .van-tag.van-tag--plain.van-tag--default{
      font-size: 15px;
      margin-left: 5px;
    }
  }

  .product-enname {
    color: #999;
    font-size: 12px;
    width: 130px;
    overflow: hidden;
  }

  .pro-info {
    width: calc(60%);
    margin-top: 5px;
    margin-left: 10px;
    align-items: center;
  }

  .product-price {
    color: #e4393c;
    font-weight: bold;
    font-size: 14px;
    margin-right: auto;
    margin-top: 10px;
  }
  .pro-remove {
    margin-left: 5px;
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: #999;
  }
}
</style>